<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/css/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/webuploader/webuploader.css" rel="stylesheet">
    <!-- <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/edit.css" rel="stylesheet"/> --> 

<style>
    .btn-primary {
        padding: 6px 12px;
        border-radius: 0em;
        margin-left:-5px; !important;
        margin-bottom: 0px;
        background-color: #20b5ad;
        border-color:#bec1c1;
    }

    .btn-primary:hover {
        color: #fff;
        background-color: #20b5ad;
        border-color: #bec1c1;
    }

    .btn-primary:active {
        color: #fff;
        background-color: #20b5ad !important;
        border-color: #bec1c1 !important;
    }

    .btn-primary:visited{
        color: #fff;
        background-color: #20b5ad !important;
        border-color: #bec1c1 !important;
    }

    .btn-white {
        padding: 6px 12px;
        border-radius: 0em;
        margin-left:10px;
        margin-bottom: 0px;
        background-color: #f05151;
        border-color:#f05151;
        color: #fff;
    }

    .btn-white:hover {
        color: #fff;
        background-color: #f05151;
        border-color: #f05151;
        
    }

    .btn-white:active {
        color: #fff;
        background-color: #f05151 !important;
        border-color: #f05151 !important;
    }

    .btn-white:visited{
        color: #fff;
        background-color: #f05151 !important;
        border-color: #f05151 !important;
    }
    .btn-white:hover, .btn-white:focus, .btn-white:active, .btn-white.active, .open .dropdown-toggle.btn-white {
        color: inherit;
        border: 1px solid #d2d2d2;
    }
    .btn-white {
        padding: 6px 12px;
        border-radius: 0em;
        margin-left: 10px;
        margin-bottom: 0px;
        background-color: #f05151;
        border-color: #f05151;
        color: #fff;
    }
    .btn {
        display: inline-block;
        padding: 4px 12px;
        margin-bottom: 0;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.42857143;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        -ms-touch-action: manipulation;
        touch-action: manipulation;
        cursor: pointer;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        background-image: none;
        border: 1px solid transparent;
        border-radius: 4px;
    }
    .btn-white:visited {
        color: #fff;
        background-color: #f05151 !important;
        border-color: #f05151 !important;
    }
    .btn-white:hover {
        color: #fff;
        background-color: #f05151;
        border-color: #f05151;
    }

    .btn.focus, .btn:focus, .btn:hover {
        color: #333;
        text-decoration: none;
    }

    .form-group{
            padding: 5px;
    }
</style>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <form class="form-horizontal m-t js-ajax-forms" id="signupForm" action="{:U('Admin/Contract/ContractBody')}<if condition="$editdata">&type=update<else />&type=add</if>" method="post" enctype="multipart/form-data">
           <!-- <input type="hidden" name="ID" value="{$editdata['ID']}"> -->
            <input type="hidden" name="ContractID" value="{$ContractID}">
            <div class="col-sm-10" style="margin: 0 auto;">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <div class="contract_conf">
                            <h2>合同模板选择</h2>
                            <div class="form-group">
                                    <label class="col-sm-3 control-label"> 模板名称： </label>
                                    <input type="hidden" name="CTID" id='CTID' value="<if condition='$data.CTID neq 0'>{$data.CTID}<else /></if>"></input>
                                    <input id="CTID_NAME"  class="form-control selector-icon"  name="CTID_NAME" aria-required="true" aria-invalid="true" class="error" 
                                    value="<if condition='$data.CTID_NAME neq NULL'>{$data.CTID_NAME}<else />不使用模板</if>">
                                   <!--  <if condition='$data.CTID neq " "'>{$data.CTID_NAME}<else />不使用模板</if> -->
                                    
                            </div>
                            </div>
                            <hr>
                            <div class="form-group">
                            <h1 class="col-sm-12 control-label" style="text-align: center;">合同详情</h1>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-12">
                                 <textarea id="Content" name="Content" style="width: 750px;height: 842px;    margin: 0 auto;">{$data.Content}</textarea>
                                </div>
                            </div>

                            <hr>
	                        <div class="form-group">
                                    <label class="col-sm-3 control-label"> 使用电子章： </label>
                                    <input type="hidden" name="StampID" id='StampID' value="<if condition='$data.StampID neq 0'>{$data.StampID}<else /></if>"></input>
                                    <input id="StampID_Name"  class="form-control selector-icon"  name="StampID_Name" aria-required="true" aria-invalid="true" class="error" value="<if condition='$data.StampID_Name neq NULL'>{$data.StampID_Name}<else />不使用电子章水印</if>">
                                    &nbsp&nbsp
                                    <label class="col-sm-3 control-label">使用水印 </label>
                                    <input type="hidden" name="WMID" id='WMID' value="<if condition='$data.WMID neq 0'>{$data.WMID}<else /></if>"></input>
                                    <input id="WMID_Name"  class="form-control selector-icon"  name="WMID_Name" aria-required="true" aria-invalid="true" class="error" value="<if condition='$data.WMID_Name neq NULL'>{$data.WMID_Name}<else />不使用水印</if>">
                            </div>
                            <hr>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">上传附件<span style="color: red">*</span></label>
                                <div class="col-sm-8">
                                <div id="uploader-demo" style="">
                                    <!--用来存放item-->
                                    <div id="fileList" class="uploader-list">
                                        <foreach name="data.cam" item="vo">
                                            <div id="WU_FILE_0"  class="webuploader-li upload-state-done"><span>{$vo.Name}</span><a href="javascript:;" id="removeFile_WU_FILE_0" class="u-mt-5 btn-block btn btn-danger button-sm" onclick="deletecam(this)" >移除</a>
                                            <input type="hidden" name="ImgInfo[]" value='{"SavePath":"<?php echo $vo['SavePath'];?>","Name":"<?php echo $vo['Name'];?>"}'>
                                            </div>
                                        </foreach>
                                    </div>
                                    <div id="filePicker" class="keep" >选择附件</div>
                                </div>
                                <div class="u-mt-10 clearfix" id="fileContent">
                                </div>
                            </div>
                            <hr>
                            <div class="form-group" style="padding: 10px;float: right;">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary keep" type="submit" style="color: white;">保存</button>
                                      <a style='text-decoration: none;' class="btn btn-white" href="javascript:void(0);" onclick="">预览</a>
                                </div>
                            </div>
                    </div>
                </div>
            </div>
            </form>
        </div>
    </div>
    

	

	<script src="__ROOT__/Public/Admin/js/jquery-1.7.2.min.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
	
	<!-- <link href="__ROOT__/Public/Admin/css/selector/selectorstyle.css" rel="stylesheet"/>
	<script src="__ROOT__/Public/Admin/js/plugins/selector/selector.js"></script>
 	<script src="__ROOT__/Public/Admin/js/plugins/selector/jquery.ztree.all.js"></script> -->
 	 <script src="__ROOT__/Public/Admin/js/plugins/layer/layer.min.js"></script>
    <!-- 引入富文本编辑器 -->
    <script  src="__ROOT__/Public/Admin/js/plugins/ueditor/custom.config.js"></script>
    <script  src="__ROOT__/Public/Admin/js/plugins/ueditor/ueditor.all.min.js"> </script>
    <!--语言包-->
    <script src="__ROOT__/Public/Admin/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>

    <script src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
    <script src="__ROOT__/Public/Admin/js/plugins/webuploader/webuploader.min.js"></script>
    <script src="__ROOT__/Public/Admin/js/plugins/webuploader/contractattachment-upload.js"></script>
    <script>
    function deletecam(e){
        $(e).parent().remove();
    }
    $(document).ready(function () {
        var baseUrl="__ROOT__/Public/Admin/js/plugins/webuploader";
        var serverUrl="/index.php?m=Admin&c=Contract&a=markupload";
        var limitNum=5;
        var upload = new Upload();
        upload.init(serverUrl,serverUrl,limitNum);
        
  
            //加载编辑器
            var ue = UE.getEditor('Content');



            var icon = "<i class='fa fa-times-circle'></i>";
            var form = $('form.js-ajax-forms');
            var formloading = false;

            var validator = $("#signupForm").submit(function() {
                    UE.getEditor('Content').sync();
                }).validate({
                     submitHandler : function(forms) {
                    if (formloading)
                    return;
                    $(forms).ajaxSubmit({
                        url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
                        dataType : 'json',
                        beforeSubmit : function(arr, $form, options) {
                            formloading = true;
                        },
                        success : function(data, statusText, xhr, $form) {
                            formloading = false;
                            if (data.status) {
                                //添加成功
                                swal({
                                    title: "继续操作？",
                                    text: "操作成功！",
                                    type: "success",
                                    showCancelButton: true,
                                    confirmButtonColor: "#DD6B55",
                                    confirmButtonText: "确认",
                                    cancelButtonText: "返回",
                                    closeOnConfirm: false,
                                    closeOnCancel: false
                                },
                                function (isConfirm) {
                                    if (isConfirm) {
                                        document.location.reload();
                                    } else {
                                        document.location.href = "{:U('Contracttemplate/index')}";
                                        return true;
                                    }
                                }); 
                            } else {
                                swal("操作失败", data.info, "error");
                            }
                        }
                    });
                },
                });
          

        });


    $('#CTID_NAME').on('click', function(){
        layer.open({
            title:'选择模板',
            type: 2,
            area: ['800px', '500px'],
            fixed: false, //不固定
            maxmin: true,
            content: "/index.php?m=Admin&c=ContractTemplate&a=select&ContractID={:I('ContractID')}&ContractType={:I('ContractType')}"
        });
    });

    $('#StampID_Name').on('click', function(){
        layer.open({
            title:'选择电子章水印',
            type: 2,
            area: ['800px', '500px'],
            fixed: false, //不固定
            maxmin: true,
            content: "/index.php?m=Admin&c=Stamp&a=select"
        });
    });

    $('#WMID_Name').on('click', function(){
        layer.open({
            title:'选择水印图标',
            type: 2,
            area: ['800px', '500px'],
            fixed: false, //不固定
            maxmin: true,
            content: "/index.php?m=Admin&c=WaterMark&a=select"
        });
    });
         
    </script>

</body>

</html>
